﻿using System;

namespace opentel.hub.data
{
    using SIPSorcery.SIP.App;
    using SIPSorcery.SIP;

    internal class SIPAccountInfo
    {
        internal static SIPAccountInfo DEFAULT = default;
        public SIPRequest Request { get; set; }
        public string User { get; set; }
        public ISIPAccount SIPAccount { get; set; }
        public SIPURI RegisteredContact { get; set; }
        public SIPEndPoint RemoteEndPoint { get; set; }
        public SIPEndPoint LocalEndPoint { get; set; }
        public long Expiry { get; set; }
        public string CallId { get; set; }
        public string FromTag { get; set; }
        public string ToTag { get; set; }
        public bool IsCalling { get; set; }
        internal AccountStatus status { get; set; }
        internal SIPAccountInfo linkaccount { get; set; }
        public SIPAccountInfo(SIPRequest sipRequest, ISIPAccount sipAccount, SIPURI contact, SIPEndPoint remote, SIPEndPoint local, long expiry)
        {
            Request = sipRequest;
            User = sipRequest.Header.From.FromName;
            SIPAccount = sipAccount;
            RegisteredContact = contact;
            RemoteEndPoint = remote;
            LocalEndPoint = local;
            Expiry = expiry;
            CallId = sipRequest.Header.CallId;
            status = AccountStatus.Free;
        }
        public bool Equal(SIPAccountInfo other)
        {
            if (Request == other.Request) return true;
            return false;
        }
    }
}
